package pro.xxh.servlet;

import pro.wyn.JdbcUtils;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet(urlPatterns = "/xxhuser/deleted")
public class UserdeletedServlet extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    }
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

        //1.获取参数
        String id = request.getParameter("id");
        //2.执行SQL
        String sql="delete from `user` where id = ? and disabled=1";
        //3.跳转到用户列表页
        JdbcUtils.modify(sql,id);
        response.sendRedirect("/xxh/user-list.jsp");
    }
}
